local weizhu = fk.CreateSkill{
  name = "plum__weizhu",
}

Fk:loadTranslationTable{
  ["plum__weizhu"] = "威驻",
  [":plum__weizhu"] = "你使用【杀】或成为【杀】的目标时，可将之的抵消方式改为连续使用两张【闪】，若如此做，此【杀】被抵消后，使用者须翻面。",
}

weizhu:addEffect(fk.TargetSpecified, {
  anim_type = "offensive",
  can_trigger = function (self, event, target, player, data)
    if player:hasSkill(weizhu.name) and player == target then
      return data.card.trueName == "slash"
    end
  end,
  on_use = function (self, event, target, player, data)
    data:setResponseTimes(2)
    data.extra_data = data.extra_data or {}
    data.extra_data.weizhu = true
  end,
})

weizhu:addEffect(fk.TargetConfirmed, {
  anim_type = "offensive",
  can_trigger = function (self, event, target, player, data)
    if player:hasSkill(weizhu.name) and player == data.to then
      return data.card.trueName == "slash"
    end
  end,
  on_use = function (self, event, target, player, data)
    data:setResponseTimes(2)
    data.extra_data = data.extra_data or {}
    data.extra_data.weizhu = true
  end
})

weizhu:addEffect(fk.CardEffectCancelledOut, {
  mute = true,
  can_trigger = function (self, event, target, player, data)
    if player:hasSkill(weizhu.name) then
      return table.contains({data.from, data.to}, player) and data.extra_data and data.extra_data.weizhu
    end
  end,
  on_cost = Util.TrueFunc,
  on_use = function (self, event, target, player, data)
    player.room:notifySkillInvoked(player, weizhu.name, (data.from == player) and "negative" or "control")
    data.from:turnOver()
  end
})

return weizhu